package cn.itcast.mapper;


import cn.itcast.pojo.Clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

public interface ClazzMapper extends BaseMapper<Clazz> {


   /* @Insert("insert into clazz (id,name , room , begin_date,end_date,master_id,subject,create_time,update_time) values (null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    int addClazz(Clazz clazz);

    // sql语句过于复杂,所以在xml中编写
    List<Clazz> findAll(@Param("name") String name, @Param("beginDate") LocalDate beginDate, @Param("endDate") LocalDate endDate);

    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    @Select("select * from clazz where id = #{id};")
    Clazz selectById(Integer id);

    @Update("update clazz set  name = #{name},room = #{room},begin_date = #{beginDate},end_date = #{endDate},master_id = #{masterId},subject = #{subject},update_time = #{updateTime} where id = #{id} ")
    int update(Clazz clazz);

    @Select("select COUNT(*) from clazz")
    long count();

    @Select("select COUNT(*) from clazz where name = #{name} and begin_date = #{beginDate} and end_date = #{endDate} ")
    long countByCoutent(String name, LocalDate beginDate, LocalDate endDate);

    @Select("select * from clazz;")
    List<Clazz> searchAll();

    @Select("select * from clazz where id = #{clazzId}")
    Clazz search(@Param("clazzId") Integer clazzId);*/
}
